/**
 * Created by admin on 18/6/13.
 */
//首页banner轮播
var swiper = new Swiper('.slideBanner .swiper-container', {
	autoplay : 3000,
    effect: 'coverflow',
    grabCursor: true,
    centeredSlides: true,
    slidesPerView: 'auto',
    coverflowEffect: {
        rotate: 50,
        stretch: 0,
        depth: 100,
        modifier: 1,
        slideShadows : true
    },
    pagination: '.swiper-pagination-indexbanner'

});
//首页顶部微信弹窗20180619
var sHTML = [
                '<style type="text/css">',
                '.topTips { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; position: fixed; left:0; top: 0; width: 100%; z-index: 100;-webkit-perspective: 600px; perspective: 600px; }',
                '.tipsInner {font-family: "Microsoft YaHei"; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-radius: 5px; background: #fff;-webkit-transform-origin: 0px 0px; transform-origin: 0px 0px; -webkit-transform: rotateX(90deg); transform: rotateX(90deg); opacity: 0; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }',
                '.tipsInner a { text-decoration:none;display: block; position: relative; padding-left: 40px; color: #666;background:#fff; }',
                '.tipsInner img { position: absolute; left: 8px; top: 50%; margin-top: -15px; width: 36px; height: auto; padding-right: 5px;}',
                '.tipsInner dl { margin:0; padding: 10px 5px;  color:#666; border-left: 1px solid #eee; margin-left: 5px; }',
                '.tipsInner dt { font-weight: normal;line-height:1.5em; }',
                '.tipsInner dd { margin:0; line-height: 1.2em;white-space:nowrap;text-overflow:ellipsis;overflow:hidden; }',
                '.showTip { visibility:visible; }',
                '.showTip .tipsInner { -webkit-transform-origin: 0px 0px; transform-origin: 0px 0px; -webkit-transform: rotateX(0deg); transform: rotateX(0deg); opacity: 1; }',
                '.hideTip { visibility:hidden; }',
                '.hideTip .tipsInner { -webkit-transform-origin: 0px 100%; transform-origin: 0px 100%; -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); opacity: 0; }',
                '</style>',
                '<div class="topTips" id="toptips">',
                '   <div class="tipsInner">',
                '       <a href="javascript:void(0);" onclick="onKST();" >',
                '         <img src="/wp-content/themes/pai2016/images/wxIcon.png" alt="">',
                '         <dl>',
                '           <dt>在线咨询</dt>',
                '           <dd>您好，请问有什么可以帮到您...</dd>',
                '         </dl>',
                '       </a>',
                '   </div>',
                '</div>' ].join('\r\n');
            var o = document.createElement('div');
            o.innerHTML = sHTML;
            while (o.firstElementChild) {
                document.body.appendChild(o.firstElementChild);

            }
            ;

            T = {
                hasClass: function (d, a) {
                    var c = d.className.split(/\s+/);
                    for (var b = 0; b < c.length; b++) {
                        if (c[b] == a) {
                            return true
                        }
                    }
                    return false
                }, addClass: function (b, a) {
                    if (!this.hasClass(b, a)) {
                        b.className += " " + a
                    }
                }, removeClass: function (d, a) {
                    if (this.hasClass(d, a)) {
                        var c = d.className.split(/\s+/);
                        for (var b = 0; b < c.length; b++) {
                            if (c[b] == a) {
                                delete c[b]
                            }
                        }
                        d.className = c.join(" ")
                    }
                }
            };

            function Toptips(options) {
                this.init(options);
            };


            Toptips.prototype = {

                constructor: Toptips,

                init: function (options) {
                    this.item = options.item;
                    this.itemInner = options.item.children[0];
                    this.loop = typeof options.loop == "undefined" ? true : options.loop;
                    this.showTime = typeof options.showTime == "undefined" ? 5000 : options.showTime;
                    this.hideTime = typeof options.hideTime == "undefined" ? 10000 : options.hideTime;
                    this.showTimer = null;
                    this.hideTimer = null;
                    this.preTimer = null;
                    this.item.style.WebkitTransition = this.item.style.transition = this.itemInner.style.WebkitTransition = this.itemInner.style.transition = "1s";
                    var me = this;
                    var initTimer = setTimeout(function () {
                        me.showTip();
                    }, 5000);
                },

                showTip: function () {
                    var me = this;
                    T.addClass(me.item, "showTip");
                    T.removeClass(me.item, "hideTip");

                    clearTimeout(me.hideTimer);

                    me.showTimer = setTimeout(function () {
                        me.hideTip();
                    }, me.showTime);

                },

                hideTip: function () {
                    var me = this;
                    T.removeClass(me.item, "showTip");
                    T.addClass(me.item, "hideTip");
                    me.item.style.visibility = me.itemInner.style.visibility = "hidden";

                    if (me.loop) {
                        clearTimeout(me.showTimer);

                        me.preTimer = setTimeout(function () {
                            me.item.style.visibility = me.itemInner.style.visibility = "visible";
                        }, me.hideTime);

                        me.hideTimer = setTimeout(function () {
                            me.showTip();
                        }, me.hideTime);

                    }
                },

            };
            var toptip = document.getElementById("toptips");

            new Toptips({
                item: toptip,
                loop: true
            });
            delete o;
// 首页顶部微信弹窗结束

